# 001,有关字符串的运算结果为：
strs001 = 'I like python and java'
one = strs001.find('n')
print(one)
two = strs001.rfind('n')
print(two)
# 12 15

# 002
strs002 = 'abbacabb'
print(strs002.strip('ab'))  # c

# 003，有关字符数组的运行结果为
names003 = ['Andrea', 'Aaslay', 'Steven', 'Joa']
lists003 = []
for name in names003:
    if name.count('a') >= 2:
        lists003.append(name)
print(lists003)  # ['Aaslay']


# 004
def outer():
    def inner():
        print('inner', end='')
    print('outer', end='')
    return inner

outer()()  # outerinner


# 005
# coding:utf-8
def test005(a, b, *args):
    print(a)
    print(b)
    print(args)


test005(11, 22, 33, 44, 55, 66, 77, 88, 99)

# 006
tmp = dict.fromkeys(['a', 'b'], 4)
print(tmp)  # {'a': 4, 'b': 4}

# 007
lists007 = [1, 2, 3, 4]
tmp007 = 0
for i, j in enumerate(lists007):
    tmp007 += i * j
print(tmp007)  # 20

# 008
lists008 = [1, 1, 2, 3, 4, 5, 6]
lists008.remove(1)
lists008.extend([7, 8, 9])
print(lists008)   # [1, 2, 3, 4, 5, 6, 7, 8, 9]

# 009
import re
str009_1 = "Python's features"
str009_2 = re.match(r'(.*)on(.*?) .*',str009_1,re.M|re.I)
print(str009_2.group(1))  # Pyth

# 010
for i in range(10, 1, -2):
    print(i)  # 10 8 6 4 2

